package com.atguigu.tingshu.account.mapper;

import com.atguigu.tingshu.model.account.UserAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

@Mapper
public interface UserAccountMapper extends BaseMapper<UserAccount> {

    public abstract UserAccount check(@Param(value = "userId") Long userId, @Param(value = "amount") BigDecimal amount);

    // 进行账户金额的锁定
    public abstract int lock(@Param(value = "userId") Long userId, @Param(value = "amount") BigDecimal amount);

    public abstract int minusAccount(@Param(value = "userId") Long userId, @Param(value = "amount") BigDecimal amount);

    public abstract int unLock(@Param(value = "userId") Long userId, @Param(value = "amount") BigDecimal amount);
}
